<%@ Control Language="C#" AutoEventWireup="true" EnableViewState="false" Inherits="BlogEngine.Core.Web.Controls.PostViewBase" %>
<script runat="server">
    public string getImage(bool ShowExcerpt, string input)
    {

        if (!ShowExcerpt || input == null)
            return "";

        string pain = input;
        string pattern = @"<img(.|\n)+?>";

        System.Text.RegularExpressions.Match m = System.Text.RegularExpressions.Regex.Match(input, pattern,

        System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.Multiline);

        if (m.Success)
        {
            string src = getSrc(m.Value);
            string img = string.Format("<img class='left' width='100' {0}  />", src);//height=\"88\" 
            return img;
        }
        else
        {
            return "";
        }
    }



    string getSrc(string input)
    {
        string pattern = "src=[\'|\"](.+?)[\'|\"]";

        System.Text.RegularExpressions.Regex reImg = new System.Text.RegularExpressions.Regex(pattern,
        System.Text.RegularExpressions.RegexOptions.IgnoreCase | System.Text.RegularExpressions.RegexOptions.Multiline);

        System.Text.RegularExpressions.Match mImg = reImg.Match(input);

        if (mImg.Success)
        {
            return mImg.Value;
        }

        return "";
    }
    
</script>

<div class="clearfloat">

<a href="<%=Post.RelativeLink %>" class="title" rel="bookmark" ><%= getImage(true,Post.Content) %></a>
<div class="info">
<a href="<%=Post.RelativeLink %>" class="title" rel="bookmark" ><%=Server.HtmlEncode(Post.Title) %></a>
<div class="meta">
[<%=Post.DateCreated.ToLongDateString() %> |
<a rel="nofollow" href="<%=Post.RelativeLink %>#comment"><%=Post.ApprovedComments.Count %> <%=Resources.labels.comments %></a>]
</div>
</div> 
</div>

